package com.yxy.service.Impl;



import com.yxy.dao.ClientContentDao;
import com.yxy.entity.ClientContent;

import com.yxy.service.ClientContentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;




/**
 *
 * ClientContentServiceImpl 实现服务类
 *
 * @version
 *
<pre>
 * Author       Version         Date            Changes
 * 邓文俊    1.0  2018-01-11 17:40:11	 	Created
 *
 * </pre>
 * @since 1.
 */
@Service
@Transactional
public class ClientContentServiceImpl implements ClientContentService {

	private Logger logger = LoggerFactory.getLogger(ClientContentServiceImpl.class);

	@Autowired
	private ClientContentDao clientContentDao;


	public boolean create(ClientContent clientContent){
		logger.info("单个新增：{}",clientContent);
		int count = clientContentDao.insert(clientContent);
		return count > 0;
	}


	public boolean update(ClientContent entity){
		logger.info("单个更新：{}", entity);
		int count = clientContentDao.updateByPrimaryKey(entity);
		return count > 0;
	}


	public boolean delete(ClientContent clientContent){
		logger.info("单个删除：{}", clientContent);
		int count = clientContentDao.deleteByPrimaryKey(clientContent);
		return count > 0;
	}

	public ClientContent findByPK(Integer id){
		ClientContent entity = new ClientContent();
		entity.setId(id);
		logger.info("单个查询：{}", entity);
		ClientContent clientContent = clientContentDao.select(entity);
		return clientContent;
	}


	public List<ClientContent> findAll(){
		ClientContent  entity = new  ClientContent();
		logger.info("查询所有：{}", entity);
		return clientContentDao.selectAll(entity);
	}









	public boolean deleteAll(List<ClientContent> list){
		logger.info("批量删除：{}", list);
		int count = clientContentDao.deleteBatch(list);
		return count > 0;
	}





	public boolean addBatch(List<ClientContent> list){
		logger.info("批量添加数据：{}",list);
		int count = clientContentDao.insertBatch(list);
		return count > 0;
	}

	public List<ClientContent> findLikeList(ClientContent clientContent){
		return clientContentDao.selectAll(clientContent);
	}
}